package com.bianmaba.beans.datacollection;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.bianmaba.spring.data.jpa.domain.entity.UuidIdentityEntity;
import lombok.Data;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;


@Entity
@DynamicUpdate(true)
@DynamicInsert(true)
//此注解重新定义为是否开始查询缓存
@QueryCacheable
//此注解表示此类支持二级缓存，缓存名称为：defaultEntityCache
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {"name"})})
@Data
public class CollectionInterface extends UuidIdentityEntity {

    //接口名称
    @Column(nullable = false)
    private String name;

    //接口类型:TMSS,DTS,DFS,云龙,其它工具缩写名称
    @Column(nullable = false, length = 16)
    private String type;

    //接口操作地址（采集微服务地址）
    @Column(nullable = false)
    private String baseUrl;

    //调用参数（传给采集微服务的列表）
    //以JSON数据定义：[｛url：'xxx',default:'xxx',required:true,inputType:'手录',description:'工具地址'｝,｛username：'xxx',default:'xxx',required:true,inputType:'手录',description:'工具地址'｝]
    //inputType:手录、项目名称，项目人员，项目开始时间，项目结束时间，迭代名称，迭代开始时间，迭代结束时间，项目版本......
    //required:true/false
    @Column(nullable = false, columnDefinition = "TEXT")
    private String parameters;

    //接口描述
    @Column(columnDefinition = "TEXT")
    private String description;
}
